﻿using System;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;

namespace Altairis.FluffyCloud.Storage {

    internal static class CloudExtensionMethods {

        public static bool Exists(this ICloudBlob blob) {
            if (blob == null) throw new ArgumentNullException("blob");
            try {
                blob.FetchAttributes();
                return true;
            }
            catch (StorageException) {
                return false;
            }
        }
    }
}